
package com.insigma.business.qrcode.common.service.impl;


import com.insigma.business.qrcode.common.dao.CommonFavoriteDao;
import com.insigma.business.qrcode.common.dto.CommonFavoriteBSearcher;
import com.insigma.business.qrcode.common.dto.CommonFavoriteDO;
import com.insigma.business.qrcode.common.service.CommonFavoriteService;
import com.insigma.business.qrcode.common.service.SequenceGenerator;
import com.insigma.business.qrcode.soldier.dto.SequenceNameConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("commonFavoriteService")
public class CommonFavoriteServiceImpl implements CommonFavoriteService {

    @Autowired(required = false)
    private CommonFavoriteDao commonFavoriteDao;
    @Autowired(required = false)
    private SequenceGenerator sequenceGenerator;



    
    @Override
    public List<CommonFavoriteDO> search(final CommonFavoriteBSearcher commonFavoriteBSearcher) {
        return commonFavoriteDao.search(commonFavoriteBSearcher);
    }
   
    @Override
    public CommonFavoriteDO get(final String id){
        return commonFavoriteDao.get(id);
    }

    
    @Override
    public Integer insert(final CommonFavoriteDO commonFavoriteDO){
        commonFavoriteDO.setId(sequenceGenerator.genKey(SequenceNameConstant.COMMON_FAVORITE_ID));
        return commonFavoriteDao.insert(commonFavoriteDO);
    }

    
    @Override
    public Integer update(final CommonFavoriteDO commonFavoriteDO){
        return commonFavoriteDao.update(commonFavoriteDO);
    }

    
    @Override
    public Integer delete(final String id, final String modifierType, final String modifierId){
        return commonFavoriteDao.delete(id,modifierType,modifierId);
    }

    @Override
    public CommonFavoriteDO getBySoldierIdAndType(String soldierId, String type) {
        return commonFavoriteDao.getBySoldierIdAndType(soldierId,type);
    }

    @Override
    public Integer countByTypeAndId(String type, String bizId) {
        return commonFavoriteDao.countByTypeAndId(type, bizId);
    }

    @Override
    public CommonFavoriteDO getBySoldierIdAndTypeAndBizId(String soldierId, String type, String bizId) {
       return commonFavoriteDao.getBySoldierIdAndTypeAndBizId(soldierId,type,bizId);
    }

    @Override
    public List<CommonFavoriteDO> searchMerchant(CommonFavoriteBSearcher commonFavoriteBSearcher) {
        return commonFavoriteDao.searchMerchant(commonFavoriteBSearcher);
    }


}
